# -*- coding: utf-8 -*-

from PyQt5.QtWidgets import QWidget, QRadioButton, QApplication, QFormLayout
import sys


class Tog(QWidget):
    def __init__(self):
        super(Tog, self).__init__()
        layout = QFormLayout()

        self.radio = QRadioButton("Button")
        # 按钮状态发生改变时发射
        self.radio.toggled.connect(lambda: self.btn(self.radio))
        layout.addWidget(self.radio)

        self.setLayout(layout)

    def btn(self, bt):
        if bt.text() == 'Button':
            if bt.isChecked() == True:
                print("GET Button1 TEXT", bt.text())
            else:
                print("DON'T Button1 GET TEXT")


if __name__ == '__main__':
    app = QApplication(sys.argv)
    tog = Tog().show()
    sys.exit(app.exec_())
